/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.modelo;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Lourenço
 */
@Entity
@Table(name = "laboratorios")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Laboratorios.findAll", query = "SELECT l FROM Laboratorios l"),
    @NamedQuery(name = "Laboratorios.findByIdlaboratorios", query = "SELECT l FROM Laboratorios l WHERE l.idlaboratorios = :idlaboratorios"),
    @NamedQuery(name = "Laboratorios.findByNumeroMaq", query = "SELECT l FROM Laboratorios l WHERE l.numeroMaq = :numeroMaq"),
    @NamedQuery(name = "Laboratorios.findByDescricao", query = "SELECT l FROM Laboratorios l WHERE l.descricao = :descricao"),
    @NamedQuery(name = "Laboratorios.findBySala", query = "SELECT l FROM Laboratorios l WHERE l.sala = :sala")})
public class Laboratorios implements Serializable {
    @OneToMany(mappedBy = "gralaboratorio")
    private Collection<Grade> gradeCollection;
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idlaboratorios")
    private Integer idlaboratorios;
    @Column(name = "numeroMaq")
    private Integer numeroMaq;
    @Size(max = 100)
    @Column(name = "descricao")
    private String descricao;
    @Column(name = "sala")
    private Integer sala;

    public Laboratorios() {
    }

    public Laboratorios(Integer idlaboratorios) {
        this.idlaboratorios = idlaboratorios;
    }

    public Integer getIdlaboratorios() {
        return idlaboratorios;
    }

    public void setIdlaboratorios(Integer idlaboratorios) {
        this.idlaboratorios = idlaboratorios;
    }

    public Integer getNumeroMaq() {
        return numeroMaq;
    }

    public void setNumeroMaq(Integer numeroMaq) {
        this.numeroMaq = numeroMaq;
    }

    public String getDescricao() {
        return descricao;
    }

    public void setDescricao(String descricao) {
        this.descricao = descricao;
    }

    public Integer getSala() {
        return sala;
    }

    public void setSala(Integer sala) {
        this.sala = sala;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idlaboratorios != null ? idlaboratorios.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Laboratorios)) {
            return false;
        }
        Laboratorios other = (Laboratorios) object;
        if ((this.idlaboratorios == null && other.idlaboratorios != null) || (this.idlaboratorios != null && !this.idlaboratorios.equals(other.idlaboratorios))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return this.descricao;
    }

    @XmlTransient
    public Collection<Grade> getGradeCollection() {
        return gradeCollection;
    }

    public void setGradeCollection(Collection<Grade> gradeCollection) {
        this.gradeCollection = gradeCollection;
    }
    
}
